	{extend name="public/base" /}
	{block name="style"}
	<link rel="stylesheet" href="__PUBLIC__/admin/material_douying/css/index.css?v=20221110&times=111" />
	<!-- <link rel="stylesheet" href="__PUBLIC__/admin/material/css/index.css?v=20221110" /> -->
	<link rel="stylesheet" href="__PUBLIC__/admin/material/css/iconfont.css" />
	{include file="material/_ali_icon" /}
	<style>
	.main-box-body .navs .active {
		background: azure;
		color: #03a9f4;
		border: 1px solid #03a9f4;
		border-radius: 5px;
	}
	a {
		color: #777;
		text-decoration:none;
	}
	a:hover { text-decoration :none}
	.table tbody>tr>td {padding: 0px 8px;}
	.table-hover>tbody>tr:nth-child(odd){background-color: #f9f9f9;}
	.table-responsive {
		min-height: 470px;
	}
	textarea.form-control {
		height: 52px;
		min-height: auto;
	}
	em{
		color: red;
	}
	.myBody::-webkit-scrollbar{
		width:5px;
	}
	/* 滚动槽 */
	.myBody::-webkit-scrollbar-track{
	-webkit-box-shadow:inset006pxrgba(0,0,0,0.8);
		border-radius:10px;
	}
	/* 滚动条滑块 */
	.myBody::-webkit-scrollbar-thumb{
		border-radius:10px;
		background:rgba(0,0,0,0.1);
		-webkit-box-shadow:inset006pxrgba(0,0,0,0.5);
	}
	</style>
	{/block}
	{block name="body"}
	<div class="main-box clearfix">
		<header class="main-box-header main-box-body clearfix" style="display: flex;width: 100%;align-items: center;padding-bottom: 0;padding-right: 20px;">
			<div>
				{include file="material/_search" /}
			</div>
			<div style="width: 100%;flex: 1;">
				<form method="get">
					<div class="col-sm-12 col-lg-2" style="width: 15%;">
						<div class="input-group">
							<input type="text" class="form-control"autocomplete="off" name="startdata" id="startdata" value="{$startdata}" autocomplete="off" placeholder="">
							<span class="input-group-addon"><i class="fa fa-th"></i></span>
						</div>
					</div>
					<div class="col-sm-12 col-lg-2" style="width: 15%;">
						<div class="input-group">
							<input type="text" class="form-control" autocomplete="off" name="enddata" id="enddata" value="{$enddata}" autocomplete="off" placeholder="">
							<span class="input-group-addon"><i class="fa fa-th"></i></span>
						</div>
					</div>
					
					
				<div class="pull-right" style="display: flex;">
					<div class="row">
						<div class="col-md-12 col-lg-8">
							<input type="text" class="form-control" name="keyword" value="{$keyword|default=''}" placeholder="请输入关键字搜索">
						</div>
						<input type="hidden" name="platform_ids" value="{:input('get.platform_ids')}">
						<input type="hidden" name="type" value="{:input('get.type')}">
						<div class="col-md-2">
							<button class="btn btn-primary" type="submit">搜索</button>
						</div>
					</div>
					<button type="button" class="btn btn-warning" style="margin-right: 10px;"> <input class="checkbox check-all" type="checkbox" style="display: inline-block;margin-top: -2px;vertical-align: middle;"> 全选 </button>
					<button class="btn btn-danger ajax-post confirm" url="{:url('del_my')}" target-form="ids">删 除</button>
				</div>
				</form>
			</div>
		</header>
		<div class="main-box-body clearfix">
			<!-- 搜索相关 -->
			<div id="" class="clear"></div>
			<div class="allTT">
				<div class="tiktok">
					<div class="row">
						<div class="col-md-4" style="width: 33.2%;">
							<div class="panel panel-default">
								<div class="panel-body" style="background: #ececec;padding: 0!important;">
									<span class="headContent" style="max-height: 120px;min-height:120px;">我是内容我是内容我是内容我是内容我是内容我是我是内容我是内容我是内容我是内容我是内容我是我是内容我是内容我是内容我是内容我是内容我是我是内容我是内容我是内容我是内容我是内容我是</span>
								</div>
								<div class="panel-footer" style="flex-direction: column;">
									<div style="width: 100%;justify-content: space-between;color: #b1b0b0;">
										<span>A014 </span>
										<div style="font-size: 15px;">文件名称</div>
										<div style="font-size: 14px;font-weight: bold;display: flex;">
											<div onclick="follow(this, 4911)" style="cursor: pointer;color: #f1927d;
											border: 1px solid #f1927d;
											padding: 0 4px;
											border-radius: 5px;">
												<!-- &nbsp;<i style="font-size:24px;" class="iconfont icon-tianjia2"></i> -->
												<i class="fa fa-plus"></i>
												查找
											</div>
										</div>
									</div>
								</div>
							</div>
						</div>
						<div class="col-md-4" style="width: 33.2%;">
							<div class="panel panel-default">
								<div class="panel-body" style="background: #ececec;padding: 0;">
									<div style="max-height: 120px;min-height:120px;position: relative;">
										<div style="position: absolute;font-size: 75px;top: 50%;left: 50%;transform: translate(-50%, -50%);display: flex;flex-direction: column;align-items: center;">
											<i class="fa fa-plus" style="color: #ccc;"></i>
											<span style="font-size: 12px;color: #8f8f8f;">添加模块</span>
										</div>
									</div>
								</div>
								<div class="panel-footer" style="flex-direction: column;">
									<div style="width: 100%;justify-content: space-between;color: #b1b0b0;height:22px">
									</div>
								</div>
							</div>
						</div>
						<div class="col-md-4" style="width: 33.2%;">
							<div class="panel panel-default">
								<div class="panel-body" style="background: #ececec;padding: 0;">
									<div style="max-height: 120px;min-height:120px;position: relative;">
										<div style="position: absolute;font-size: 75px;top: 50%;left: 50%;transform: translate(-50%, -50%);display: flex;flex-direction: column;align-items: center;">
											<i class="fa fa-plus" style="color: #ccc;"></i>
											<span style="font-size: 12px;color: #8f8f8f;">添加模块</span>
										</div>
									</div>
								</div>
								<div class="panel-footer" style="flex-direction: column;">
									<div style="width: 100%;justify-content: space-between;color: #b1b0b0;height:22px">
									</div>
								</div>
							</div>
						</div>
					</div>
					<div class="row toolTip" style="overflow-y: scroll;height: 65.5vh;">
						
					{volist name="list" id="vo"}
						<div class="col-md-4">
							<div class="panel panel-default">
								<div class="panel-body myBody" style="padding: 0!important;">
									<span class="headContent" style="padding: 0 30px;{if $vo['is_edit']==2}color:#b92a1db8;{/if}" data-id="{$vo['id']}" data-title="{$vo['title']}">{:str_replace("####","<br/>",htmlspecialchars_decode($vo['content_old']))}</span>
									<!-- <div class="num">{$vo['id']}</div> -->
								</div>
								<div class="panel-footer">
									<div style="width: 100%;justify-content: space-between;color: #b1b0b0;">
										<span>{$vo['num']} </span>
										<span>{$vo.show_time}</span>
									</div>
									<div style="justify-content: space-between;width: 100%;">
										<div style="display: flex;align-items: center;">
											<td style="padding: 10px;"><input class="ids row-selected" type="checkbox" name="id[]" value="{$vo['id']}" style="margin:0"></td>&nbsp;
											<span class="title">{$vo.book_id_zh}</span>
											<div class="tiktokLabel">
												{$vo.tag_ids_zh}
											</div>
										</div>
										<div style="font-size: 14px;display: flex;">
											<div onclick="copyContent(`{:str_replace("####","<br/>",htmlspecialchars_decode($vo['content_zh2']))}`, '{$vo['id']}',false)" class="copy">
												<span class="iconfont icon-copy"></span>
												复制
											</div>
											<div class="edit">
												编辑
											</div>
										</div>
									</div>
								</div>
							</div>
							<div class="mask">
								<div class="content">{:str_replace("####","<br/>",htmlspecialchars_decode($vo['content_old']))}</div>
								<!-- <div class="content2" style="display:none;">{:str_replace("####","<br/>",htmlspecialchars_decode($vo['content_old']))}</div> -->
							</div>
						</div>
					{/volist}	
					</div>
				</div>
				<div class="tiktok_editor">
					<textarea class="head" name="" id="" cols="30" rows="10" style="padding: 0;color: #818181;font-size: 14px;line-height: 22px"></textarea>
					<div style="border:1px solid #ccc;">
						<div style="background: #ececec;height: calc(100% - 42px);">
							<textarea style="height: 60vh;" class="content" id="editContentText" name="" id="" cols="30" rows="10"></textarea>
						</div>
						<div class="panel-footer">
							<div class="title">
								<input type="text" id="idtitle" placeholder="抖音文案1">
								<input type="hidden" id="myid" value="">
							</div>
							<div class="editor_btn">
								<div onclick="goCopy()" class="copy">复制</div>
								<div class="save" onclick="editContent(this)" data-json=''>保存</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		{$page}
	</div>

	<div class="modal fade" id="create-referral-link-modal">
		<div class="modal-dialog" role="document">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
				<span style="font-size: 20px;"><span id="referralname">添加</span></span>
			</div>
			<div class="modal-body">
				<div data-bind="visible: loading" class="loading-panel" style="display: none;">
					<i class="fa fa-spin fa-spinner"></i>
				</div>
				<form class="form-horizontal modelform">
					{include file="material/_from" /}
				</form>
			</div>
			<div class="modal-footer">
				<button type="button" id="createreferral" class="btn btn-primary ">提交</button>
			</div>
		</div>
	</div>
	</div>

	{include file="adsmaterialbook/_from" /}
	{/block}
	{block name="script"}
	<script type="text/javascript">
		function goCopy(){
			copyContent($('#editContentText').val(),9999,false)
		}

		$(function() {
			
			$('#add_my_one').on('click',function(){
				var url = "{:url('add_my_one')}";
				$.ajax({
					type: "POST",
					url: url,
					data:{"platform_ids":{$platform_id},"type":'{$typeid}'},
					dataType: "json",
					success: function(data){
						if(data.code==1){
							updateAlert(data.msg, 'success');
							setTimeout(function() {	
								window.location.reload();
							}, 100);
						}else{
							updateAlert("添加，"+data.msg, 'danger');
						}
					},
					error : function(e){
						console.log(e.status);
						console.log(e.responseText);
					}
				})
			});
			$('#add_one').on('click',function(){
				var $modal = $('#create-referral-link-modal');
				$modal.on('shown.bs.modal', function () {
				});	
				$modal.modal({backdrop: 'static', keyboard: false})
			});
			$("#createreferral").on('click',function(){
				var data = $('.modelform').serializeJson();
				console.log(data);
				if ( data['book_id'] == undefined) {
					updateAlert("书名不能为空", 'danger');
					return false;
				}
				if (data['content'].length==0) {
					updateAlert("不能为空", 'danger');
					return false;
				}
				var url = "{:url('add_my')}";
				$.ajax({
					type: "POST",
					url: url,
					data:data,
					dataType: "json",
					success: function(data){
						if(data.code==1){
							updateAlert(data.msg, 'success');
							setTimeout(function() {	
								window.location.reload();
							}, 100);
						}else{
							updateAlert("添加，"+data.msg, 'danger');
						}
					},
					error : function(e){
						console.log(e.status);
						console.log(e.responseText);
					}
				})
			});
		});


		function editContent(ee){
			var id = $("#myid").val();
			var idtitle = $("#idtitle").val();
			var content = $('#editContentText').val().replace(`
	`,"\r\n");
			$.ajax({
				type: "POST",
				url: '{:url("editMyContent")}',
				data:{id:id, content:content,title:idtitle, 'platform_ids':{$platform_id},"type":{$typeid}},
				dataType: "json",
				success: function(data){
					if(data.code==1){
						updateAlert(data.msg, 'success');
						setTimeout(function() {	
							window.location.reload();
						}, 100);
					}else{
						updateAlert("添加，"+data.msg, 'danger');
					}
				},
				error : function(e){
					console.log(e.status);
					console.log(e.responseText);
				}
			})
		}

		$('.edit').click(function(){
			var ee = $(this).parent().parent().parent().siblings().children('span');
			var id = $(ee).attr("data-id");
			var title = $(ee).attr("data-title");
			let content = $(ee).html().replace(/<em>/g, '').replace(/<\/em>/g, '').replace(/<br>/g, '\r\n').replace(/&nbsp;/g, ' ');
			$('.tiktok_editor .content').val(content);
			if(title == ""){
				title = "抖音文案"+id;
			}
			$("#idtitle").val(title);
			$("#myid").val(id);
		})
		$(function(){
			var my_id = '{:input('get.my_id', 0)}';
			if(parseInt(my_id) > 0){
				$(".edit").click()
			}
		});
</script>
<script src="/public/plugs/datepicker/js/foundation-datepicker.js"></script>
<script>
	$('#startdata').fdatepicker({
		format: 'yyyy-mm-dd',
		// pickTime: true
	});
	$('#enddata').fdatepicker({
		format: 'yyyy-mm-dd',
		// pickTime: true
	});
</script>
{include file="material/pub_footer"}
{/block}